using MyHomeworkWebAPi.Models.ef;

namespace MyHomeworkWebAPi.Models.DTOs
{
    public class UserDTO
    {
        public Guid UserId { get; set; }
        public string StudentId { get; set; } = string.Empty;
        public string Nickname { get; set; } = string.Empty;
        public string Phone { get; set; } = string.Empty;
        public string Avatar { get; set; } = "default.png";

        public static UserDTO? FromUser(MyHomeworkWebAPi.Models.ef.User? user)
        {
            if (user == null) return null;

            return new UserDTO
            {
                UserId = user.UserId,
                StudentId = user.StudentId,
                Nickname = user.Nickname,
                Phone = user.Phone,
                Avatar = user.Avatar
            };
        }
    }
} 